﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Pseudogenerator.Common.Generators.Core;

namespace Pseudogenerator.Common.Generators
{
    public class Mixed : MethodBase
    {

        public uint k { get; set; }
        public uint n { get; set; }



        public override bool CanGenerateNext
        {
            get { return k > 15 && ActualIndex <= m && m > k && n>54; }
        }

        public override uint GetNextValue()
        {
            throw new NotImplementedException();
        }

        public override List<RandomNumber> GetFullList()
        {

            Green gn = new Green();
            gn.m = this.m;
            gn.k = this.k;
            MitchellMoore mm = new MitchellMoore();
            mm.m = this.m;
            mm.n = this.n;

            var nums = new List<RandomNumber>();
            var green = new List<RandomNumber>(gn.GetFullList());
            var mitchellmoore = new List<RandomNumber>(mm.GetFullList());

            if (!(mitchellmoore.Count == 0) && !(green.Count == 0))
            {
                for (int i = 0; i < m; i++)
                {
                    var r = (green[i].Uniform * m + mitchellmoore[i].Uniform * m) % m;
                    var resultado = r;
                    mitchellmoore.Add(new RandomNumber(m) { n = (uint)i, Xn = (uint)resultado });
                    nums.Add(new RandomNumber(m) { n = (uint)i, Xn = (uint)resultado });
                }
            }
            return nums;
        }

        public override string ToString()
        {
            return string.Format("k = ({0}), m =({1}), n =({2})", k, m, n);
        }
    }
}




